Skip to content

RG-T129 Notification System bug fixes - #446

Merged
ucswift merged 5 commits into
masterfrom
develop
Aug 5, 2026
Merged

RG-T129 Notification System bug fixes#446
ucswift merged 5 commits into
masterfrom
develop

Conversation

@ucswift

@ucswift ucswift commented Aug 4, 2026

Copy link
Copy Markdown
Member

PR Description: RG-T129 Notification System Bug Fixes

Summary

This PR fixes several bugs in the notification system that prevented notifications from firing correctly and caused runtime errors under certain conditions.

Changes

Bug Fix: Incorrect Event Type in Group Lookup

In GetGroupForEventAsync, the code block that looks up personnel staffing data was incorrectly matched against PersonnelStatusChanged instead of PersonnelStaffingChanged. This meant group-based notifications for staffing changes would never resolve the correct department group.

Bug Fix: Empty BeforeData/CurrentData Causing Notifications to Never Fire

The notification validation logic previously returned false whenever BeforeData or CurrentData was null or empty. Since the UI's "Any" option was posting an empty string, notifications saved with default "Any" settings would never trigger. The validation now treats empty/null values as "-1" (the system's "Any" sentinel), allowing these notifications to process as intended.

Bug Fix: NullReferenceException When No Previous State Exists

For UnitStatusChanged, PersonnelStaffingChanged, and PersonnelStatusChanged events, when a "before" state was required but no prior state existed (e.g., the very first state change), the code would throw a null reference exception. Null checks were added so the notification is safely skipped (returns false) instead of crashing. A missing null check on currentState was also added for PersonnelStatusChanged.

Bug Fix: UI Dropdown Posting Incorrect "Any" Value

The client-side dropdown initialization was changed to post "-1" for the "Any" option instead of an empty string, aligning with the notification engine's expected value format. The API calls for populating these dropdowns were updated to stop requesting an "Any" entry from the server (includeAny=False), since it is now provided client-side.

Test Coverage

New unit tests were added covering:

  • Notifications processing when BeforeData/CurrentData are empty (should succeed)
  • Graceful handling when no previous state exists for each event type (should return false without throwing)
  • Group resolution for PersonnelStaffingChanged and PersonnelStatusChanged events

Summary by CodeRabbit

  • New Features

    • Added moderation tools for reporting, reviewing, completing, and auditing flagged chat, dispatch, and system content.
    • Administrators can search requests, review reports and retained evidence, track actions, and notify reporters.
    • Added localized moderation messaging, status indicators, and administrator-only controls.
    • Moderated message deletions are now clearly identified.
  • Bug Fixes

    • Improved notification matching for blank values and personnel or unit status changes.
    • Deleted or unavailable attachments now return appropriate not-found responses.
    • Improved call-edit validation, message length handling, subscription expiry checks, and template editor initialization.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants